<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>关闭由 proc_open 打开的进程并且返回进程退出码</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.passthru.html">« passthru</a></li>
      <li style="float: right;"><a href="function.proc-get-status.html">proc_get_status »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.exec.html">程序执行函数</a></li>
    <li>关闭由 proc_open 打开的进程并且返回进程退出码</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.proc-close" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">proc_close</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">proc_close</span> &mdash; <span class="dc-title">关闭由 <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span> 打开的进程并且返回进程退出码</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.proc-close-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>proc_close</strong></span>(<span class="methodparam"><span class="type">resource</span> <code class="parameter">$process</code></span>): <span class="type">int</span></div>

  <p class="para rdfs-comment">
    <span class="function"><strong>proc_close()</strong></span> 同 <span class="function"><a href="function.pclose.html" class="function">pclose()</a></span> 函数类似，只是
    <span class="function"><strong>proc_close()</strong></span> 只能用来关闭由 <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span>
    函数打开的进程。<span class="function"><strong>proc_close()</strong></span>
    函数会等待进程终止，并返回它的退出代码。调用此函数时，为避免死锁，该进程打开的管道将关闭——在管道处于打开状态时，子进程将不能退出。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.proc-close-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">process</code></dt>

     <dd>

      <p class="para">
       要关闭的由 <span class="function"><a href="function.proc-open.html" class="function">proc_open()</a></span> 打开的 <span class="type">resource</span> 。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.proc-close-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
    返回进程的终止状态码。
    如果发生错误，将返回  <code class="literal">-1</code>。
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
 <p class="para">
  如果 PHP 是通过 --enable-sigchild 编译的，此函数将没有返回值。
 </p>
</p></blockquote>

 </div>


</div></div></div></body></html>